package com.lightdz.tshirtdz.controller;

import com.lightdz.tshirtdz.bll.LoginBll;
import com.lightdz.tshirtdz.general.ApiConfig;
import com.lightdz.tshirtdz.model.api.ApiResponse;
import com.lightdz.tshirtdz.model.api.login.ApiLogin;
import com.lightdz.tshirtdz.model.api.login.ApiLoginFail;

import com.sun.javafx.binding.StringFormatter;
import javafx.beans.binding.StringExpression;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.lang.reflect.Type;

/**
 * @ Description：${description}
 * @ Author     ：zbl
 * @ Date       ：Created in 14:29 06/08/2018
 * @ Modified By：
 */

@RestController
@RequestMapping("/login")
public class LoginController {

    @Autowired
    LoginBll loginBll;

    /**
     *
     * @param js_code 登录时获取的 code
     * @return
     */
    @RequestMapping(value="/login",method = RequestMethod.GET)
    public ApiResponse<String> login(String js_code){

        String appid="wxe2f34834a1e3cf13";
        String secret="4982a3c0332aac75c0f3ec5f67616e17";//小程序的 app secret
        String grant_type="authorization_code";//填写为 authorization_code
        return  loginBll.getLoginResult(appid,secret,js_code,grant_type);

    }




}
